package cmd

import (
	"gitee.com/crack007/goose"
	"gitee.com/crack007/goose/core/command"
	"github.com/crack007/go-im/src/module/sentinel/handle"
	"github.com/spf13/cobra"
)

func NewSentinelCommand() *goose.ModuleBuilder {
	sentinelHandle := handle.NewSentinelHandle()
	builder := command.NewCmdBuilder(sentinelHandle)
	builder.RegisterFlag(func(cobraCmd *cobra.Command) {
		cobraCmd.PersistentFlags().StringVar(&sentinelHandle.MasterIp, "masterip", "", "master节点IP")
		cobraCmd.PersistentFlags().Uint16Var(&sentinelHandle.MasterPort, "masterport", 0, "master节点端口")
	})
	builder.EnableGraceful().EnableDebugFlag().EnableConfigFlag().EnablePprof()
	return goose.NewModuleBuilder(builder).SetName("sentinel").SetDesc("监控模块")
}
